package cn.cdutetc.library.entity.dto;

import com.fasterxml.jackson.annotation.JsonGetter;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 借阅信息视图对象
 */
@Data
@Schema(description = "借阅信息视图对象")
public class BorrowVO {

    @Schema(description = "借阅ID")
    private Integer borrowId;

    @Schema(description = "用户ID")
    private Integer userId;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "用户真实姓名")
    private String realName;

    @Schema(description = "图书ID")
    private Integer bookId;

    @Schema(description = "图书条目ID")
    private Integer itemId;

    @Schema(description = "图书名称")
    private String bookName;

    @Schema(description = "ISBN")
    private String isbn;

    @Schema(description = "作者")
    private String author;

    @Schema(description = "借阅时间")
    private LocalDateTime borrowTime;

    @Schema(description = "应还时间")
    private LocalDateTime dueTime;

    @Schema(description = "实际归还时间")
    private LocalDateTime returnTime;

    @Schema(description = "借阅状态：borrowing/returned/overdue/lost")
    private String status;

    @Schema(description = "状态描述")
    private String statusDesc;

    @Schema(description = "罚款金额")
    private Double fineAmount;

    @Schema(description = "是否已支付罚款")
    private Boolean finePaid;

    @Schema(description = "续借次数")
    private Integer renewCount;

    // --- 前端兼容别名映射 ---

    @JsonGetter("recordId")
    public Integer getRecordId() {
        return this.borrowId;
    }

    @JsonGetter("userName")
    public String getUserName() {
        return this.username;
    }

    @JsonGetter("username")
    public String getUsername() {
        return this.username;
    }

    @JsonGetter("borrowDate")
    public LocalDateTime getBorrowDate() {
        return this.borrowTime;
    }

    @JsonGetter("dueDate")
    public LocalDateTime getDueDate() {
        return this.dueTime;
    }

    @JsonGetter("returnDate")
    public LocalDateTime getReturnDate() {
        return this.returnTime;
    }
}